package com.example.research.service;

import com.example.research.model.ResearchType;
import com.example.research.repository.ResearchTypeRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;

@Service
public class ResearchTypeService {
    @Autowired
    private ResearchTypeRepository researchTypeRepository;

    public List<ResearchType> findAll() {
        return researchTypeRepository.findAll();
    }

    public ResearchType save(ResearchType researchType) {
        return researchTypeRepository.save(researchType);
    }

    public void delete(Integer id) {
        researchTypeRepository.deleteById(id);
    }

    public ResearchType findById(Integer id) {
        return researchTypeRepository.findById(id).orElse(null);
    }
}